import * as type from './mutations-types'

export default {
    // content 上下文（理解成store对象）
    actionsUpdataInfo(context) {
        setTimeout(() => {
            context.commit(type.ACTIONSUPDATAMESSAGE);
        }, 1000);
    },
    actionsUpdataAge(context, payload) {
        setTimeout(() => {
            context.commit(type.ACTIONSUPDATAAGE, payload);
            console.log(payload);
        }, 1000);
    },
    succeedUpdata(context, payload) {
        setTimeout(() => {
            context.commit(type.SUCCESSDUPDATA);
            payload();
        }, 1000);
    },
    succeedUpdataMessage(context, payload) {
        setTimeout(() => {
            context.commit(type.SUCCESSDUPDATAMESSAGE, payload.message);
            console.log(payload.message);
            payload.success();
        }, 1000);
    },
    succeedUpdataMessage_good(context, payload) {
        return new Promise((resolve, reject) => {
                setTimeout(() => {
                    // 这里也有根的概念，只是根跟自己一样
                    console.log(context, 'store对象中打印context');

                    context.commit(type.SUCCESSDUPDATAMESSAGE_GOOD, payload);
                    console.log(payload);

                    resolve('里面已经完成修改了');
                }, 1000);
            })
            // .then(res => { console.log(res); })
    },
}